<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <link rel="shortcut icon" href="" type="image/x-icon">
    <meta content="telephone=no,email=no" name="format-detection">
    <title>demo</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        .page {
            width: 100%;
            height: 50vh;
            line-height: 50vh;
            text-align: center;
        }
    </style>
</head>
<body>
<div class="page" id="event" style="background-color: greenyellow">
    event 触摸滑动这里
</div>
<div class="page" id="es6" style="background-color: snow">
    es6 触摸滑动这里
</div>
<script src="./touch-event.js"></script>
<script src="./touch-es6.js"></script>
<script>
    // touch-es6
    const esTouch = new Touch(document.querySelector('#es6'));
    console.log(esTouch)
    esTouch.on('throttle-move', (e) => {
        console.log('throttle move', e);
    })
    esTouch.on('tap', (e) => {
        console.log('es tap', e);
    })
    esTouch.on('press', (e) => {
        console.log('press', e);
    });
    esTouch.on('swipe', (e) => {
        console.log('es swipe', e);
    })
    esTouch.on('swipe-left', () => {
        console.log('swipeLeft');
    });
    esTouch.on('swipe-right', () => {
        console.log('swipeRight');
    });

    // touch-event
    var myTouch = new touch('#event');
    myTouch.on('throttle-move', (e) => {
        console.log('throttle move', e);
    });
    myTouch.on('tap', function (e) {
        console.log('tap', e);
    });
    myTouch.on('press', function (e) {
        console.log('press', e);
    });
    myTouch.on('swipe', function () {
        console.log('swipe');
    });
    myTouch.on('swipe-left', function () {
        console.log('swipeLeft');
    });
    myTouch.on('swipe-right', function () {
        console.log('swipeRight');
    });
</script>
</body>
</html>